@extends("admin.layout.main")

@section("content")
    <link rel="stylesheet" href="/adminlte/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/adminlte/dist/css/AdminLTE.min.css">
    <!-- Main content -->
    <section class="content">
        <!-- Small boxes (Stat box) -->
        <div class="row">
            <div class="col-lg-10 col-xs-6">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">权限列表</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <form action="/admin/roles/{{$role->id}}/permission" method="POST">
                            {{csrf_field()}}
                            <div class="form-group">
                                <table class="layui-table" lay-skin="line">
                                    <colgroup>
                                        <col width="200">
                                        <col width="200">
                                    </colgroup>
                                    <thead>
                                    <tr>
                                        <th>权限</th>
                                        <th>备注名</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                        @foreach($permissions as $permission)
                                            <tr>
                                                <label>
                                                    <td><input type="checkbox" name="permissions[]"
                                                           @if ($myPermissions->contains($permission))
                                                           checked
                                                           @endif
                                                           value="{{$permission->id}}">
                                                            {{$permission->name}}</td>
                                                    <td>{{$permission->description}}</td>
                                                </label>
                                         </tr>
                                        @endforeach
                                    </tbody>
                                </table>
                            </div>
                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">提交</button>
                            </div>
                        </form>


                    </div>
                </div>
            </div>
        </div>
    </section>
@endsection